using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Runtime.Serialization;

namespace KPIS.GERP.Models.BGM
{
	[Table("bgm_mas_source"), DataContract]
    public class MasBudgetSource
    {
        public MasBudgetSource()
        {
            LowerMasBudgetSources = new HashSet<MasBudgetSource>();
            //MasPurchaseRegularMappings = new HashSet<ICM.MasPurchaseRegularMapping>();
        }

        [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        [DataMember, Display(Name = "BgSourceId", ResourceType = typeof(Resources.MasBudgetSourceResource))]
		[Column("bgm_source_seq", TypeName="int")]
        public int BgSourceId { get; set; }

        [DataMember, Display(Name = "Code", ResourceType = typeof(Resources.MasBudgetSourceResource))]
		[Column("bgm_source_code", TypeName="ntext")]
        public string Code { get; set; }

        [DataMember, Display(Name = "GfmisCode", ResourceType = typeof(Resources.MasBudgetSourceResource))]
		[Column("gfmis_code", TypeName="ntext")]
        public string GfmisCode { get; set; }

        [DataMember, Display(Name = "Name", ResourceType = typeof(Resources.MasBudgetSourceResource))]
		[Column("bgm_source_name", TypeName="ntext")]
        public string Name { get; set; }

        [DataMember, Display(Name = "Description", ResourceType = typeof(Resources.MasBudgetSourceResource))]
        [Column("bgm_source_descr", TypeName="ntext")]
        public string Description { get; set; }

        [ForeignKey("UpperMasBudgetSource")]
        [DataMember, Display(Name = "UpperBgSourceId", ResourceType = typeof(Resources.MasBudgetSourceResource))]
		[Column("upper_bgm_source_seq", TypeName="int")]
        public int? UpperBgSourceId { get; set; }

        [ForeignKey("MasBudgetSourceType")]
        [DataMember, Display(Name = "BgSourceTypeId", ResourceType = typeof(Resources.MasBudgetSourceResource))]
		[Column("bgm_source_type_seq", TypeName="int")]
        public int? BgSourceTypeId { get; set; }

        [ForeignKey("YearType")]
        [DataMember, Display(Name = "YearTypeId", ResourceType = typeof(Resources.MasBudgetSourceResource))]
        [Column("bgm_year_type_seq", TypeName="int")]
        public int? YearTypeId { get; set; }

        [DataMember, Display(Name = "UsePetition", ResourceType = typeof(Resources.MasBudgetSourceResource))]
		[Column("use_petition", TypeName="bit")]
        public bool UsePetition { get; set; }

        [DataMember, Display(Name = "UseRequest", ResourceType = typeof(Resources.MasBudgetSourceResource))]
		[Column("use_request", TypeName="bit")]
        public bool UseRequest { get; set; }

        [DataMember]
        public virtual MasBudgetSource UpperMasBudgetSource { get; set; }

        [DataMember]
        public virtual MasBudgetSourceType MasBudgetSourceType { get; set; }

        [DataMember]
        public virtual SYS.YearType YearType { get; set; }

        [DataMember]
        public virtual ICollection<MasBudgetSource> LowerMasBudgetSources { get; set; }

        //[DataMember]
        //public virtual ICollection<ICM.MasPurchaseRegularMapping> MasPurchaseRegularMappings { get; set; }

        #region RecordStatus

        [DataMember, Display(Name = "RecordStatus", ResourceType = typeof(SYS.Resources.RecordStatusResource))]
		[Column("record_status", TypeName="ntext")]
        public string RecordStatus { get; set; }

        [DataMember, Display(Name = "CreatedBy", ResourceType = typeof(SYS.Resources.RecordStatusResource))]
		[Column("created_by", TypeName="int")]
        public Nullable<int> CreatedBy { get; set; }

        [DataMember, Display(Name = "CreatedWhen", ResourceType = typeof(SYS.Resources.RecordStatusResource))]
		[Column("created_when", TypeName="datetime2")]
        public Nullable<System.DateTime> CreatedWhen { get; set; }

        [DataMember, Display(Name = "UpdatedBy", ResourceType = typeof(SYS.Resources.RecordStatusResource))]
		[Column("updated_by", TypeName="int")]
        public Nullable<int> UpdatedBy { get; set; }

        [DataMember, Display(Name = "UpdatedWhen", ResourceType = typeof(SYS.Resources.RecordStatusResource))]
		[Column("updated_when", TypeName="datetime2")]
        public Nullable<System.DateTime> UpdatedWhen { get; set; }

        #endregion

    }
}